home *** CD-ROM | disk | FTP | other *** search
- UNIT MOIREINIT;
-
- INTERFACE
-
- USES MacIntf,MOIREGLOBALS,ZOOM;
-
- PROCEDURE Init;
-
- PROCEDURE MakeMenus;
-
- PROCEDURE MakeWindow;
-
- PROCEDURE LoseWindow (theWindow : WindowPtr);
-
- IMPLEMENTATION
-
- PROCEDURE Init;
- VAR
- index : integer;
- BEGIN
- MaxApplZone;
- FOR index := 1 TO 4 DO
- MoreMasters;
- InitGraf(@thePort);
- InitFonts;
- InitWindows;
- InitMenus;
- TEInit;
- InitDialogs(NIL);
- InitCursor;
- FlushEvents(EveryEvent, 0);
-
- Step := 8;
- CurrentPat := 3;
- Flashing := FALSE;
- SetDAFont(2);
- flashRate := 120;
- flashPhase := FALSE;
- END;
-
- PROCEDURE MakeMenus;
- VAR
- appleCh : char;
- index : integer;
- menuStr : Str255;
- BEGIN
- appleCh := CHR($14);
- AppleMenu := NewMenu(AppleID, appleCh);
- AppendMenu(AppleMenu, 'About Moire...;(-');
- AddResMenu(AppleMenu, 'DRVR');
- InsertMenu(AppleMenu, 0);
-
- FileMenu := NewMenu(FileID, 'File');
- AppendMenu(FileMenu, 'Quit/Q');
- InsertMenu(FileMenu, 0);
-
- EditMenu := NewMenu(EditID, 'Edit');
- AppendMenu(EditMenu, '(Undo/Z;(-;(Cut/X;(Copy/C;(Paste/V;(Clear');
- InsertMenu(EditMenu, 0);
-
- PatMenu := NewMenu(PatMenuID, 'Pattern');
- AppendMenu(PatMenu, 'Pen Pattern.../P;Step Value.../S;Invert/I;Flash');
- CheckItem(PatMenu, FlashItem, FALSE);
- InsertMenu(PatMenu, 0);
-
- DrawMenuBar;
- END;
-
- PROCEDURE MakeWindow;
- VAR
- r1,r2,r3, cRect : rect;
- BEGIN
- setRect(r1,0,20,20,40);
- setRect(r2,236,172,276,192);
- setRect(r3, 20, 40, 492, 322);
- myWindow := newWindow(NIL, r3, 'Moire Patterns', FALSE, 4, WindowPtr(-1), TRUE, 0);
- cRect := myWindow^.portRect;
- cRect.left := cRect.right - SBarWidth;
- cRect.top := cRect.top + topLine - 1;
- FlashControl := newControl(myWindow, cRect, '', TRUE, flashRate, 8, flashRate, 16, 0);
- setPort(myWindow);
- TextFont(4);
- TextSize(9);
- TextMode(srcCopy);
- MoireRect := myWindow^.portRect;
- MoireRect.top := MoireRect.top + topLine;
- MoireRect.right := MoireRect.right - SBarWidth;
- ZoomRect(r1,r2,TRUE);
- ZoomRect(r2,r3,TRUE);
- showWindow(myWindow);
- WITH myWindow^.portRect DO
- BEGIN
- LastPoint.h := (right - left) DIV 2;
- LastPoint.v := (bottom - top) DIV 2;
- END;
- END;
-
- PROCEDURE LoseWindow;
- var
- r1,r2,r3 : rect;
- BEGIN
- r3 := theWindow^.portRect;
- setRect(r2,236,172,276,192);
- setRect(r1,0,20,20,40);
- HideWindow(theWindow);
- ZoomRect(r2,r3,FALSE);
- ZoomRect(r1,r2,FALSE);
- END;
-
- END.